-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implemented cksum #39
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the binary and then ensure the binary is not pushed by adding it to the .gitignore
list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
�
#define VERSION "0.0.1" | ||
#define AUTHOR "cospplredman" | ||
|
||
#include"../version_info.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include"../version_info.h" | |
#include "/version_info.h" |
#define X(a,...) for(a)for(r=(r<<8)^(e&0xff)^__VA_ARGS__,e=0,i=31;i>23;i--)if(r&(1<<i))r^=(1<<i)|(q>>(32-i)),e^=q<<(i-24); | ||
|
||
uint32_t q=0x04c11db7,r,e;d,i=1,t,j,k,f=2;main(c,v)char**v;{ | ||
if(c<2)exit(1); | ||
for(;++k<c;){ | ||
if(f&&(!strcmp(v[k], "--")|!strcmp(v[k], "-v"))){ | ||
if(v[k][1]=='-')f=0; | ||
if(f==2){f=1;print_version();} | ||
continue; | ||
} | ||
FILE*f=fopen(v[k],"r"); | ||
if(f==NULL)exit(1); | ||
X(;(d=getc(f))>=0;t++,d)X(j=t;j;,(j&0xff),j>>=8)X(j=3;j--;,0) | ||
if(printf("%u %d %s\n",~((r<<8)|(e&0xff)),t,v[k])<0)exit(1); | ||
r=e=t=0; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you refactor your code to make it readable? The goal isn't to code golf the coreutils
quick little implementation of cksum ��